﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Anglo.Models;
using Anglo.DB;
using System.Web.Configuration;

namespace AngloCom.Controllers
{
    public class jobsController : AngloWebController
    {

        public ActionResult index()
        {
            return View();
        }

        public ActionResult details(int id)
        {
            JobDetails job = new AngloDBStatic(connectionString).GetJob(id);
            return View(job);
        }

        public ActionResult industry(int id)
        {
            AngloDB db = new AngloDBStatic(connectionString);
            List<JobHierarchy> jobs = db.GetJobsByIndustry(id);
            Industry industry = db.GetIndustryByID(id);
            ViewBag.industry = industry;
            return View(jobs);
        }

        public ActionResult discipline(int id)
        {
            AngloDB db = new AngloDBStatic(connectionString);
            List<JobHierarchy> jobs = db.GetJobsByDiscipline(id);
            Discipline discipline = db.GetDisciplineByID(id);
            ViewBag.discipline = discipline;
            return View(jobs);
        }

        public ActionResult location(int id)
        {
            AngloDB db = new AngloDBStatic(connectionString);
            List<JobHierarchy> jobs = db.GetJobsByLocation(id);
            Location location = db.GetLocationByID(id);
            ViewBag.location = location;
            return View(jobs);
        }

        public ActionResult search(SearchParameters search)
        {
            AngloDB db = new AngloDBStatic(connectionString);
            List<JobHierarchy> jobs = db.GetJobsByParams(search);
            return View(jobs);
        }

    }
}
